<template>
	<view class="good" @click="changePopType">
		<text class="tag max-bg" v-if="value.level_id==1">
			至尊款
		</text>
		<text class="tag special-bg" v-else-if="value.level_id==2">
			稀有款
		</text>
		<text class="tag hide-bg" v-else-if="value.level_id==3">
			隐藏款
		</text>
		<text class="tag pt-bg" v-else-if="value.level_id==4">
			普通款
		</text>
		<view class="header">
			<image :src="$util.img(value.goods_image)" mode="widthFix"></image>
		</view>
		<view class="name">{{value.goods_name}}</view>
		<view class="des">{{value.des}}</view>
		<view class="price">
			<view class="price-content">
				<text class="label">参考价:</text>
				<view class="value">
					<text>¥</text>
					<text>{{value.sku_price}}</text>
					<!-- <text>.90</text> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			value: {
				type: Object
			}
		},
		methods: {
			changePopType() {
				this.$emit('changePopType', {
					type: 'detail',
					fromType:'good',
					value:this.value
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.good {
		padding: 20rpx;
		box-sizing: border-box;
		width: 345rpx;
		min-height: 479rpx;
		background: #FFFFFF;
		border-radius: 21rpx;
		position: relative;
		display: flex;
		flex-direction: column;

		.tag {
			position: absolute;
			z-index: 5;
			top: 41rpx;
			left: 4rpx;
			width: 86rpx;
			height: 28rpx;
			border-radius: 0px 0px 14rpx 0px;
			font-size: 24rpx;
			line-height: 28rpx;
			text-align: center;
			font-weight: 500;
			color: #FFFFFF;

			&::after {
				content: " ";
				position: absolute;
				left: 0;
				bottom: 0;
				transform: translateY(100%);
				height: 0;
				width: 0;
			}
		}

		// .hot-bg {
		// 	background: linear-gradient(90deg, #FF0863, #FF5877);

		// 	&::after {
		// 		border-left: 8rpx solid transparent;
		// 		border-top: 5rpx solid #F51F56;
		// 		border-bottom: 5rpx solid transparent;
		// 		border-right: 8rpx solid #F51F56;
		// 	}
		// }

		// .new-bg {
		// 	background: linear-gradient(67deg, #FFCA5E, #FFA110);

		// 	&::after {
		// 		border-left: 8rpx solid transparent;
		// 		border-top: 5rpx solid #FFCA5E;
		// 		border-bottom: 5rpx solid transparent;
		// 		border-right: 8rpx solid #FFA110;
		// 	}
		// }

		.max-bg {
			background: linear-gradient(67deg, #FF5DA2, #FB4565);

			&::after {
				border-left: 8rpx solid transparent;
				border-top: 5rpx solid #FF5DA2;
				border-bottom: 5rpx solid transparent;
				border-right: 8rpx solid #FF5DA2;
			}
		}

		.special-bg {
			background: linear-gradient(67deg, #FFC967, #FFA02D);

			&::after {
				border-left: 8rpx solid transparent;
				border-top: 5rpx solid #FFCA5E;
				border-bottom: 5rpx solid transparent;
				border-right: 8rpx solid #FFA110;
			}
		}

		.hide-bg {
			background: linear-gradient(67deg, #9551FF, #BA8EFF);

			&::after {
				border-left: 8rpx solid transparent;
				border-top: 5rpx solid #9551FF;
				border-bottom: 5rpx solid transparent;
				border-right: 8rpx solid #9551FF;
			}
		}

		.pt-bg {
			background: linear-gradient(67deg, #5383FF, #72BCFF);

			&::after {
				border-left: 8rpx solid transparent;
				border-top: 5rpx solid #5383FF;
				border-bottom: 5rpx solid transparent;
				border-right: 8rpx solid #5383FF;
			}
		}

		.header {
			flex: 1;
			>image {
				width: 100%;
				height: 100%;
				// width: 305rpx;
				// height: 305rpx;
			}
		}

		.name {
			font-size: 28rpx;
			font-family: Source Han Sans CN;
			font-weight: 500;
			color: #111111;
			width: 100%;
			text-overflow: ellipsis;
			overflow: hidden;
			display:-webkit-box;  //弹性盒模型
			-webkit-box-orient:vertical;  //上下垂直
			-webkit-line-clamp:2;  //自定义行数
		}

		.des {
			font-size: 19rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #999999;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.price {
			display: flex;
			justify-content: center;
			font-weight: bold;

			.price-content {
				flex: 1;
				line-height: 0;
				color: #FF0036;
				margin-top: 18rpx;
				display: flex;
				align-items: center;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #111111;

				.label {
					font-size: 21rpx;
					color: #999999;
				}

				.value {
					&>text:nth-of-type(1) {
						font-size: 26rpx;
						margin-right: 5rpx;
					}

					&>text:nth-of-type(3) {
						font-size: 26rpx;
					}
				}

			}
		}
	}
</style>
